package com.hzz.dto.dsync;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.hzz.framework.dto.BaseDto;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
public class ErReportPageResultDto<T> extends BaseDto {
    Integer Code;
    Integer PageIndex;
    Integer PageSize;
    Integer TotalPage;
    Integer TotalCount;
    String Message;
    String Data;
    Boolean IsError;

    List<T> PageData;

    public boolean isHasNextPage(Integer pageNum, Integer pageSize) {
        boolean isHasNextPage = false;
        if (pageNum * pageSize < TotalCount) {
            isHasNextPage = true;
        }
        return isHasNextPage;
    }

    public int getPageCount(Integer pageSize) {
        return (TotalCount + pageSize - 1) / pageSize;
    }
}
